package dialogs;

import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.ImageView;

import com.example.administrator.newxlmedical.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import constants.HandlerConstant;
import custom.MyDialog;
import customhandler.MyHandler;
import singleton.SingletonClass;

/**
 * Created by Administrator on 2018/5/15.
 */

public class UserManageFingerDialog extends MyDialog {

    @BindView(R.id.iv_dialog_user_manage_fingerprint_close)
    ImageView ivClose;
    @BindView(R.id.iv_dialog_user_manage_fingerprint)
    ImageView ivDialogUserManageFingerprint;
    private MyHandler allHandler;
    private Context mContext;

    public UserManageFingerDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
        mContext = context;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_user_manage_fingerprint);

        ButterKnife.bind(this);
        allHandler = SingletonClass.getSingleton(MyHandler.class);
        setOnDismissListener(new OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialog) {
                allHandler.sendEmptyMessage(HandlerConstant.CANCLE_FINGERPRINT_COMMAND);
            }
        });
    }

    @OnClick({R.id.iv_dialog_user_manage_fingerprint_close})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_dialog_user_manage_fingerprint_close:
                dismiss();
//                allHandler.sendEmptyMessage(HandlerConstant.CANCLE_FINGERPRINT_COMMAND);
                break;
        }
    }

    public ImageView getFingerIcon() {

        return ivDialogUserManageFingerprint;
    }

//    public interface OnClickListener {
//        void onSure(String number, String name, String role);
//    }
//
//    @Override
//    public void setOnDismissListener(@Nullable OnDismissListener listener) {
//        super.setOnDismissListener(listener);
//        Log.e("TAG", "setOnDismissListener: " );
//        allHandler.sendEmptyMessage(HandlerConstant.CANCLE_FINGERPRINT_COMMAND);
//    }
}
